var mongoose = require("mongoose");

//收藏表(like)
var likeSchema = new mongoose.Schema({
  articleid: {
    type: mongoose.SchemaTypes.ObjectId,
    ref: "article",
  }, //文章id
  artictype: {
    type: String,
    required: true
  }, //文章类型
  userid: {
    type: mongoose.SchemaTypes.ObjectId,
    ref: "user_login",
    required: true
  }, //用户id
  like_time: {
    type: Date,
    default: new Date()
  }, //收藏时间
  problem_id: {
    type: mongoose.SchemaTypes.ObjectId,
    ref: "problem",
  }, //问题
  answer_id: {
    type: mongoose.SchemaTypes.ObjectId,
    ref: "answer",
  }, //回答
  resource_id: {
    type: mongoose.SchemaTypes.ObjectId,
    ref: "resource",
  }
});

module.exports = mongoose.model("like", likeSchema);